<template>
	<div class='protocol'>
		<u-parse :content="article" @preview="preview" @navigate="navigate"></u-parse>
	</div>
</template>

<script>
	import {
		marked
	} from 'marked'
	import uParse from 'components/u-parse/u-parse.vue'
	import {getAgreementUrl} from "apis/agreement.js"
	export default {
		components: {
			uParse
		},
		computed: {
			article() {
				return marked("")
			}
		},
		async onLoad() {
			const {type,title} = this.$Route.query
			if(title){
				uni.setNavigationBarTitle({title})
			}
			const result = await getAgreementUrl(type)
			uni.openDocument({
				filePath: result
			})
		},
		methods: {
			preview(src, e) {
				// do something
			},
			navigate(href, e) {
				// do something
			}
		}
	}
</script>

<style>
	@import url("../../../components/u-parse/u-parse.css");
	.protocol{
		padding: 40rpx 40rpx 80rpx;
	}
</style>
